package top.huahaizhi.zhihu.daily.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import top.huahaizhi.zhihu.daily.R;
import top.huahaizhi.zhihu.daily.bean.LatestNewsBean;
import top.huahaizhi.zhihu.daily.util.Utils;

/**
 * 海志 在 2017/8/4 0004 创建
 *
 * @mail huahaizhi@gmail.com
 * 功能：
 */

public class StoryAdapter extends BaseQuickAdapter<LatestNewsBean.StoriesBean, BaseViewHolder> {

    private Context context;

    public StoryAdapter(Context context, @LayoutRes int layoutResId, @Nullable List<LatestNewsBean.StoriesBean> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, LatestNewsBean.StoriesBean item) {
        Utils.getInstance(context).loadImage(item.getImages().get(0), (ImageView) helper.getView(R.id.iv_content_img),R.drawable.ic_replace_holder,R.drawable.ic_replace_holder);
        helper.setText(R.id.tv_content_title, item.getTitle());
    }
}